
Security News
Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Features | Install | Usage | Examples
Parsec is a tiny CLI parser.
--no-*
optionsnpm install parsec
// ./index.js -par5ec
parse()
{
"p": true,
"a": true,
"r": "5ec"
}
Customize:
// ./index.js -s42
parse("secret", ["verbose", "V", { default: true }])
{
"s": 42,
"secret": 42,
"V": true,
"verbose": true
}
Parse
process.argv
by default.
import parse from "parsec"
parse(alias1, alias2, ...)
// ./index.js --bar
parse(["foo", "bar", "baz"])
{
"foo": true,
"bar": true,
"baz": true
}
"foo" // → ["f", "foo"]
["F", "f", "foo"]
["foo", { default: "./" }]
["baz", { default: true }]
// ./index.js -fb
parse("foo", "bar")
{
"f": true,
"foo": true,
"b": true,
"bar": true,
}
// ./index.js --file
parse(["f", "file", { default: "." }])
{
"f": ".",
"file": "."
}
--no-flags
// ./index.js --no-foo --no-bar=baz
parse()
{
"foo": false,
"no-bar": "baz"
}
// ./index.js --bar
parse("foo", (option) => {
throw new RangeError(`unknown option ${option}`) // bar
})
--
are added to ._
. To override:parse(["_", "alias"])
parse
to a different source of arguments:parse.call(["--foo", "--bar"], [alias1, alias2, ...])
// ./node index.js -f bar -bp
parse()
{
"f": "bar",
"b": true,
"p": "./"
}
with custom aliases:
parse("foo", "bar", ["path", { default: "./" }])
{
"f": "bar",
"foo": "bar",
"b": true,
"bar": true,
"p": "./",
"path": "./"
}
FAQs
A duration parser and formatter to turn random garbage into program usable times.
The npm package parsec receives a total of 146 weekly downloads. As such, parsec popularity was classified as not popular.
We found that parsec demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Security News
React's CRA deprecation announcement sparked community criticism over framework recommendations, leading to quick updates acknowledging build tools like Vite as valid alternatives.
Security News
Ransomware payment rates hit an all-time low in 2024 as law enforcement crackdowns, stronger defenses, and shifting policies make attacks riskier and less profitable.